package cn.machen.www.fashion.dao;

import cn.itcast.jdbc.TxQueryRunner;
import cn.machen.www.fashion.pojo.Category;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class CategoryDao {
    private QueryRunner queryRunner = new TxQueryRunner();

    //查询所有目录
    public List<Category> findAll(){
        String sql = "select * from category";
        try {
            return queryRunner.query(sql,new BeanListHandler<Category>(Category.class));
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }


}
